package com.tiut.lmap.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")//设置允许跨域请求的源（域名
                .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")//作用：设置允许的 HTTP 请求方法
                .allowedHeaders("*");
    }
}
